class A:
    def __init__(self, txt: str):
        self.r: D = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.y: E = None
        self.o: E = None
        self.p: C = None
        self.z: F = None
        self.s: D = None
        self.v: D = None
        self.txt = txt

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

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

class E:
    def __init__(self, txt: str):
        self.p: D = None
        self.x: F = None
        self.s: F = None
        self.y: B = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.y: A = None
        self.v: B = None
        self.z: C = None
        self.q: A = None
        self.txt = txt

f = A("f")
i = B("i")
b = C("b")
g = D("g")
n = E("n")
d = F("d")
a = E("a")

f.r = g
i.y = n
i.o = n
i.p = b
i.z = d
i.s = g
i.v = g
b.y = d
b.v = i
b.z = a
g.x = f
g.t = b
g.s = b
g.q = i
n.p = g
n.x = d
n.s = d
n.y = i
d.y = f
d.q = f
d.v = i
d.z = b
a.p = g
a.x = d
a.s = d
a.y = i
assert d.z.z.x.txt == "
class A:
    def __init__(self, txt: str):
        self.r: D = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.y: E = None
        self.o: E = None
        self.p: C = None
        self.z: F = None
        self.s: D = None
        self.v: D = None
        self.txt = txt

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

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

class E:
    def __init__(self, txt: str):
        self.p: D = None
        self.x: F = None
        self.s: F = None
        self.y: B = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.y: A = None
        self.v: B = None
        self.z: C = None
        self.q: A = None
        self.txt = txt

f = A("f")
i = B("i")
b = C("b")
g = D("g")
n = E("n")
d = F("d")
a = E("a")

f.r = g
i.y = n
i.o = n
i.p = b
i.z = d
i.s = g
i.v = g
b.y = d
b.v = i
b.z = a
g.x = f
g.t = b
g.s = b
g.q = i
n.p = g
n.x = d
n.s = d
n.y = i
d.y = f
d.q = f
d.v = i
d.z = b
a.p = g
a.x = d
a.s = d
a.y = i
assert d.z.z.x.txt == "d"