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

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

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

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

class E:
    def __init__(self, txt: str):
        self.p: D = None
        self.txt = txt

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

l = A("l")
g = B("g")
h = C("h")
b = D("b")
f = E("f")
c = F("c")

l.y = g
l.v = g
l.p = h
l.o = c
g.y = f
g.z = c
g.r = l
h.w = g
h.x = l
h.y = f
b.s = c
b.o = f
f.p = b
c.x = h
c.u = l
c.o = l
c.q = l
c.v = f
assert c.q.v.r.p.x.txt == "
class A:
    def __init__(self, txt: str):
        self.y: B = None
        self.p: C = None
        self.o: F = None
        self.v: B = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.p: D = None
        self.txt = txt

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

l = A("l")
g = B("g")
h = C("h")
b = D("b")
f = E("f")
c = F("c")

l.y = g
l.v = g
l.p = h
l.o = c
g.y = f
g.z = c
g.r = l
h.w = g
h.x = l
h.y = f
b.s = c
b.o = f
f.p = b
c.x = h
c.u = l
c.o = l
c.q = l
c.v = f
assert c.q.v.r.p.x.txt == "l"