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

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

class C:
    def __init__(self, txt: str):
        self.t: E = None
        self.u: E = None
        self.txt = txt

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

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

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

g.o = c
i.r = k
j.t = k
j.u = c
e.w = f
k.o = g
k.t = j
k.q = h
c.o = g
c.t = j
c.q = l
d.o = k
l.t = k
l.u = k
f.o = c
h.t = c
h.u = c
assert g.o.q.t.o.txt == "
class A:
    def __init__(self, txt: str):
        self.o: E = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.t: E = None
        self.u: E = None
        self.txt = txt

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

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

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

g.o = c
i.r = k
j.t = k
j.u = c
e.w = f
k.o = g
k.t = j
k.q = h
c.o = g
c.t = j
c.q = l
d.o = k
l.t = k
l.u = k
f.o = c
h.t = c
h.u = c
assert g.o.q.t.o.txt == "g"