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

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

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

f = A("f")
h = B("h")
e = C("e")
a = C("a")
c = C("c")
b = C("b")
d = B("d")
l = C("l")
g = A("g")

f.s = d
h.t = b
e.u = f
e.p = b
e.v = h
a.u = g
a.p = l
a.v = h
c.u = f
c.p = b
c.v = h
b.u = f
b.p = e
b.v = d
d.t = c
l.u = g
l.p = a
l.v = h
g.s = d
assert c.v.t.p.p.p.v.t.txt == "
class A:
    def __init__(self, txt: str):
        self.s: B = None
        self.txt = txt

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

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

f = A("f")
h = B("h")
e = C("e")
a = C("a")
c = C("c")
b = C("b")
d = B("d")
l = C("l")
g = A("g")

f.s = d
h.t = b
e.u = f
e.p = b
e.v = h
a.u = g
a.p = l
a.v = h
c.u = f
c.p = b
c.v = h
b.u = f
b.p = e
b.v = d
d.t = c
l.u = g
l.p = a
l.v = h
g.s = d
assert c.v.t.p.p.p.v.t.txt == "b"