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

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

class C:
    def __init__(self, txt: str):
        self.s: A = None
        self.v: F = None
        self.r: D = None
        self.w: A = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.t: F = None
        self.v: C = None
        self.txt = txt

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

d = A("d")
e = B("e")
a = C("a")
c = D("c")
j = E("j")
b = F("b")
g = A("g")

d.t = c
d.p = e
e.v = a
e.u = j
e.p = c
a.s = d
a.v = b
a.r = c
a.w = g
c.x = d
c.s = e
j.t = b
j.v = a
b.o = a
g.t = c
g.p = e
assert a.s.t.s.v.r.txt == "
class A:
    def __init__(self, txt: str):
        self.t: D = None
        self.p: B = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.s: A = None
        self.v: F = None
        self.r: D = None
        self.w: A = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.t: F = None
        self.v: C = None
        self.txt = txt

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

d = A("d")
e = B("e")
a = C("a")
c = D("c")
j = E("j")
b = F("b")
g = A("g")

d.t = c
d.p = e
e.v = a
e.u = j
e.p = c
a.s = d
a.v = b
a.r = c
a.w = g
c.x = d
c.s = e
j.t = b
j.v = a
b.o = a
g.t = c
g.p = e
assert a.s.t.s.v.r.txt == "c"