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

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

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

class D:
    def __init__(self, txt: str):
        self.x: C = None
        self.r: F = None
        self.p: E = None
        self.v: E = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.p: E = None
        self.z: A = None
        self.txt = txt

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

a.v = d
a.w = f
a.r = e
d.s = j
d.z = c
c.w = a
c.s = f
j.x = c
j.r = f
j.p = e
j.v = e
e.u = c
f.p = e
f.z = a
assert a.r.u.w.r.u.w.txt == "
class A:
    def __init__(self, txt: str):
        self.v: B = None
        self.w: F = None
        self.r: E = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.x: C = None
        self.r: F = None
        self.p: E = None
        self.v: E = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.p: E = None
        self.z: A = None
        self.txt = txt

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

a.v = d
a.w = f
a.r = e
d.s = j
d.z = c
c.w = a
c.s = f
j.x = c
j.r = f
j.p = e
j.v = e
e.u = c
f.p = e
f.z = a
assert a.r.u.w.r.u.w.txt == "a"