class A:
    def __init__(self, txt: str):
        self.x: B = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.o: A = None
        self.v: C = None
        self.txt = txt

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

g.x = h
h.t = i
h.q = f
k.p = g
k.x = j
k.y = c
f.o = m
m.o = g
m.v = k
b.x = h
d.o = g
d.v = k
i.t = h
i.q = f
c.o = b
c.v = k
j.o = m
assert j.o.o.x.t.t.t.q.o.v.txt == "
class A:
    def __init__(self, txt: str):
        self.x: B = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.o: A = None
        self.v: C = None
        self.txt = txt

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

g.x = h
h.t = i
h.q = f
k.p = g
k.x = j
k.y = c
f.o = m
m.o = g
m.v = k
b.x = h
d.o = g
d.v = k
i.t = h
i.q = f
c.o = b
c.v = k
j.o = m
assert j.o.o.x.t.t.t.q.o.v.txt == "k"