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

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

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

i = A("i")
b = B("b")
d = C("d")
g = C("g")
c = A("c")
k = B("k")
m = B("m")
n = B("n")

i.o = c
i.s = g
b.t = i
d.v = g
d.u = g
d.x = n
g.v = d
g.u = d
g.x = k
c.o = i
c.s = g
k.t = i
m.t = i
n.t = c
assert b.t.s.u.x.t.s.txt == "
class A:
    def __init__(self, txt: str):
        self.o: A = None
        self.s: C = None
        self.txt = txt

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

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

i = A("i")
b = B("b")
d = C("d")
g = C("g")
c = A("c")
k = B("k")
m = B("m")
n = B("n")

i.o = c
i.s = g
b.t = i
d.v = g
d.u = g
d.x = n
g.v = d
g.u = d
g.x = k
c.o = i
c.s = g
k.t = i
m.t = i
n.t = c
assert b.t.s.u.x.t.s.txt == "g"