class A:
    def __init__(self, txt: str):
        self.p: C = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.t: D = None
        self.u: A = None
        self.y: D = None
        self.v: C = None
        self.x: D = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.o: D = None
        self.w: D = None
        self.y: E = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.v: E = None
        self.q: B = None
        self.y: C = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.t: B = None
        self.x: D = None
        self.txt = txt

a = A("a")
b = B("b")
f = C("f")
j = D("j")
m = E("m")
k = A("k")
i = C("i")
h = E("h")

a.p = i
b.t = j
b.y = j
b.x = j
b.u = a
b.v = f
f.o = j
f.w = j
f.y = m
j.v = h
j.q = b
j.y = f
m.t = b
m.x = j
k.p = i
i.o = j
i.w = j
i.y = m
h.t = b
h.x = j
assert h.x.y.y.t.x.v.x.v.txt == "
class A:
    def __init__(self, txt: str):
        self.p: C = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.t: D = None
        self.u: A = None
        self.y: D = None
        self.v: C = None
        self.x: D = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.o: D = None
        self.w: D = None
        self.y: E = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.v: E = None
        self.q: B = None
        self.y: C = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.t: B = None
        self.x: D = None
        self.txt = txt

a = A("a")
b = B("b")
f = C("f")
j = D("j")
m = E("m")
k = A("k")
i = C("i")
h = E("h")

a.p = i
b.t = j
b.y = j
b.x = j
b.u = a
b.v = f
f.o = j
f.w = j
f.y = m
j.v = h
j.q = b
j.y = f
m.t = b
m.x = j
k.p = i
i.o = j
i.w = j
i.y = m
h.t = b
h.x = j
assert h.x.y.y.t.x.v.x.v.txt == "h"