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

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

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

class D:
    def __init__(self, txt: str):
        self.v: C = None
        self.x: D = None
        self.q: A = None
        self.p: B = None
        self.txt = txt

k = A("k")
f = B("f")
m = C("m")
e = D("e")
d = A("d")
g = D("g")
l = A("l")
h = C("h")
a = B("a")

k.x = l
k.q = h
f.q = g
f.o = d
f.t = a
m.w = e
m.t = e
m.o = g
m.p = h
e.v = m
e.x = g
e.q = d
e.p = f
d.x = l
d.q = h
g.v = h
g.x = e
g.q = d
g.p = a
l.x = k
l.q = h
h.w = g
h.o = g
h.p = m
h.t = e
a.q = e
a.o = k
a.t = f
assert g.x.p.t.t.t.txt == "
class A:
    def __init__(self, txt: str):
        self.x: A = None
        self.q: C = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.v: C = None
        self.x: D = None
        self.q: A = None
        self.p: B = None
        self.txt = txt

k = A("k")
f = B("f")
m = C("m")
e = D("e")
d = A("d")
g = D("g")
l = A("l")
h = C("h")
a = B("a")

k.x = l
k.q = h
f.q = g
f.o = d
f.t = a
m.w = e
m.t = e
m.o = g
m.p = h
e.v = m
e.x = g
e.q = d
e.p = f
d.x = l
d.q = h
g.v = h
g.x = e
g.q = d
g.p = a
l.x = k
l.q = h
h.w = g
h.o = g
h.p = m
h.t = e
a.q = e
a.o = k
a.t = f
assert g.x.p.t.t.t.txt == "a"