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

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

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

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

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

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

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

d.x = g
d.s = l
d.p = a
d.z = b
g.x = b
g.q = d
b.o = d
b.v = a
e.y = l
e.u = g
l.q = e
l.t = d
a.r = d
a.s = b
assert d.z.o.z.txt == "
class A:
    def __init__(self, txt: str):
        self.x: B = None
        self.s: E = None
        self.p: F = None
        self.z: C = None
        self.txt = txt

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

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

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

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

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

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

d.x = g
d.s = l
d.p = a
d.z = b
g.x = b
g.q = d
b.o = d
b.v = a
e.y = l
e.u = g
l.q = e
l.t = d
a.r = d
a.s = b
assert d.z.o.z.txt == "b"