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

class B:
    def __init__(self, txt: str):
        self.p: E = None
        self.txt = txt

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

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

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

i = A("i")
k = B("k")
g = C("g")
a = D("a")
f = E("f")
d = C("d")
h = A("h")

i.q = f
k.p = f
g.u = i
g.p = i
g.o = k
a.t = h
a.s = h
f.y = k
d.u = h
d.p = i
d.o = k
h.q = f
assert a.t.q.y.p.y.p.y.txt == "
class A:
    def __init__(self, txt: str):
        self.q: E = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.p: E = None
        self.txt = txt

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

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

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

i = A("i")
k = B("k")
g = C("g")
a = D("a")
f = E("f")
d = C("d")
h = A("h")

i.q = f
k.p = f
g.u = i
g.p = i
g.o = k
a.t = h
a.s = h
f.y = k
d.u = h
d.p = i
d.o = k
h.q = f
assert a.t.q.y.p.y.p.y.txt == "k"