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

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

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

b = A("b")
l = B("l")
e = C("e")
h = A("h")
d = B("d")
n = B("n")
f = C("f")
j = C("j")

b.q = j
l.u = n
l.y = e
e.v = f
e.o = l
e.u = n
h.q = e
d.u = n
d.y = j
n.u = d
n.y = e
f.v = e
f.o = l
f.u = n
j.v = f
j.o = d
j.u = l
assert b.q.o.y.txt == "
class A:
    def __init__(self, txt: str):
        self.q: C = None
        self.txt = txt

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

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

b = A("b")
l = B("l")
e = C("e")
h = A("h")
d = B("d")
n = B("n")
f = C("f")
j = C("j")

b.q = j
l.u = n
l.y = e
e.v = f
e.o = l
e.u = n
h.q = e
d.u = n
d.y = j
n.u = d
n.y = e
f.v = e
f.o = l
f.u = n
j.v = f
j.o = d
j.u = l
assert b.q.o.y.txt == "j"