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

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

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

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

d.t = a
d.x = c
d.p = c
a.v = d
a.s = j
a.t = j
f.y = c
g.v = j
g.s = j
g.t = j
j.t = g
j.x = c
j.p = c
m.t = a
m.x = f
m.p = c
c.y = f
assert j.x.y.y.y.y.y.txt == "
class A:
    def __init__(self, txt: str):
        self.t: B = None
        self.x: C = None
        self.p: C = None
        self.txt = txt

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

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

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

d.t = a
d.x = c
d.p = c
a.v = d
a.s = j
a.t = j
f.y = c
g.v = j
g.s = j
g.t = j
j.t = g
j.x = c
j.p = c
m.t = a
m.x = f
m.p = c
c.y = f
assert j.x.y.y.y.y.y.txt == "f"