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

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

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

e = A("e")
c = B("c")
h = C("h")
b = A("b")
d = A("d")
n = A("n")
f = C("f")
k = A("k")

e.r = d
e.t = c
e.x = c
c.v = f
h.r = c
h.w = f
b.r = k
b.t = c
b.x = c
d.r = n
d.t = c
d.x = c
n.r = b
n.t = c
n.x = c
f.r = c
f.w = h
k.r = e
k.t = c
k.x = c
assert d.r.r.x.v.txt == "
class A:
    def __init__(self, txt: str):
        self.r: A = None
        self.t: B = None
        self.x: B = None
        self.txt = txt

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

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

e = A("e")
c = B("c")
h = C("h")
b = A("b")
d = A("d")
n = A("n")
f = C("f")
k = A("k")

e.r = d
e.t = c
e.x = c
c.v = f
h.r = c
h.w = f
b.r = k
b.t = c
b.x = c
d.r = n
d.t = c
d.x = c
n.r = b
n.t = c
n.x = c
f.r = c
f.w = h
k.r = e
k.t = c
k.x = c
assert d.r.r.x.v.txt == "f"