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

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

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

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

k = A("k")
g = B("g")
c = C("c")
m = D("m")
j = B("j")
i = C("i")
h = C("h")

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

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

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

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

k = A("k")
g = B("g")
c = C("c")
m = D("m")
j = B("j")
i = C("i")
h = C("h")

k.o = g
g.q = j
c.q = g
c.y = g
c.r = j
c.t = j
m.t = i
j.q = g
i.q = g
i.y = g
i.r = j
i.t = j
h.q = j
h.r = g
h.y = g
h.t = g
assert k.o.q.q.txt == "g"