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

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

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

l = A("l")
c = B("c")
d = C("d")
j = A("j")
n = C("n")

l.v = j
l.w = j
l.t = c
c.u = n
c.x = l
c.t = l
d.y = n
d.r = n
d.t = l
j.v = l
j.w = l
j.t = c
n.y = d
n.r = d
n.t = j
assert d.y.t.t.txt == "
class A:
    def __init__(self, txt: str):
        self.v: A = None
        self.w: A = None
        self.t: B = None
        self.txt = txt

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

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

l = A("l")
c = B("c")
d = C("d")
j = A("j")
n = C("n")

l.v = j
l.w = j
l.t = c
c.u = n
c.x = l
c.t = l
d.y = n
d.r = n
d.t = l
j.v = l
j.w = l
j.t = c
n.y = d
n.r = d
n.t = j
assert d.y.t.t.txt == "c"