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

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

class C:
    def __init__(self, txt: str):
        self.z: F = None
        self.o: D = None
        self.r: B = None
        self.w: A = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.s: D = None
        self.u: F = None
        self.txt = txt

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

h = A("h")
d = B("d")
n = C("n")
b = D("b")
f = E("f")
g = F("g")
e = C("e")
c = A("c")

h.o = g
h.r = g
h.v = d
h.z = c
h.p = b
h.w = f
d.s = h
d.y = b
n.z = g
n.o = b
n.r = d
n.w = c
b.p = h
b.t = d
b.y = g
f.s = b
f.u = g
g.y = n
e.z = g
e.o = b
e.r = d
e.w = h
c.o = g
c.r = g
c.v = d
c.z = h
c.p = b
c.w = f
assert b.y.y.r.txt == "
class A:
    def __init__(self, txt: str):
        self.o: F = None
        self.v: B = None
        self.z: A = None
        self.p: D = None
        self.w: E = None
        self.r: F = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.z: F = None
        self.o: D = None
        self.r: B = None
        self.w: A = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.s: D = None
        self.u: F = None
        self.txt = txt

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

h = A("h")
d = B("d")
n = C("n")
b = D("b")
f = E("f")
g = F("g")
e = C("e")
c = A("c")

h.o = g
h.r = g
h.v = d
h.z = c
h.p = b
h.w = f
d.s = h
d.y = b
n.z = g
n.o = b
n.r = d
n.w = c
b.p = h
b.t = d
b.y = g
f.s = b
f.u = g
g.y = n
e.z = g
e.o = b
e.r = d
e.w = h
c.o = g
c.r = g
c.v = d
c.z = h
c.p = b
c.w = f
assert b.y.y.r.txt == "d"