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

class B:
    def __init__(self, txt: str):
        self.u: F = None
        self.x: D = None
        self.v: A = None
        self.o: C = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.y: D = None
        self.v: F = None
        self.u: D = None
        self.z: F = None
        self.txt = txt

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

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

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

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

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

class B:
    def __init__(self, txt: str):
        self.u: F = None
        self.x: D = None
        self.v: A = None
        self.o: C = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.y: D = None
        self.v: F = None
        self.u: D = None
        self.z: F = None
        self.txt = txt

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

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

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

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

i.v = b
i.z = a
i.s = j
i.w = j
a.u = j
a.x = b
a.v = i
a.o = d
d.y = b
d.u = b
d.v = j
d.z = j
b.r = j
b.u = d
b.v = a
c.w = a
c.s = d
c.r = i
c.x = b
j.p = d
j.v = d
assert b.u.v.v.txt == "d"