class A:
    def __init__(self, txt: str):
        self.z: C = None
        self.txt = txt

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

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

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

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

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

g = A("g")
f = B("f")
c = C("c")
e = D("e")
b = E("b")
i = F("i")

g.z = c
f.o = i
f.p = e
f.q = g
c.o = e
c.u = f
e.r = c
e.x = c
e.y = i
b.o = c
b.v = e
b.q = e
b.p = f
i.w = f
i.t = f
i.y = f
i.r = b
i.o = g
i.z = e
assert c.u.p.y.o.txt == "
class A:
    def __init__(self, txt: str):
        self.z: C = None
        self.txt = txt

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

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

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

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

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

g = A("g")
f = B("f")
c = C("c")
e = D("e")
b = E("b")
i = F("i")

g.z = c
f.o = i
f.p = e
f.q = g
c.o = e
c.u = f
e.r = c
e.x = c
e.y = i
b.o = c
b.v = e
b.q = e
b.p = f
i.w = f
i.t = f
i.y = f
i.r = b
i.o = g
i.z = e
assert c.u.p.y.o.txt == "g"