class A:
    def __init__(self, txt: str):
        self.t: A = None
        self.v: B = None
        self.y: B = None
        self.txt = txt

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

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

g = A("g")
f = B("f")
c = C("c")
h = C("h")
m = C("m")
j = A("j")

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

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

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

g = A("g")
f = B("f")
c = C("c")
h = C("h")
m = C("m")
j = A("j")

g.t = j
g.v = f
g.y = f
f.q = j
f.v = c
c.w = j
c.x = j
c.o = g
h.w = j
h.x = g
h.o = g
m.w = g
m.x = g
m.o = g
j.t = g
j.v = f
j.y = f
assert c.x.y.q.txt == "j"