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

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

class C:
    def __init__(self, txt: str):
        self.p: B = None
        self.txt = txt

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

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

class F:
    def __init__(self, txt: str):
        self.s: B = None
        self.txt = txt

k = A("k")
f = B("f")
c = C("c")
g = D("g")
a = E("a")
e = F("e")

k.o = c
k.s = c
k.q = a
k.x = e
f.y = g
c.p = f
g.p = e
a.z = g
a.q = f
a.y = f
a.v = f
e.s = f
assert k.q.y.y.p.txt == "
class A:
    def __init__(self, txt: str):
        self.o: C = None
        self.q: E = None
        self.x: F = None
        self.s: C = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.p: B = None
        self.txt = txt

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

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

class F:
    def __init__(self, txt: str):
        self.s: B = None
        self.txt = txt

k = A("k")
f = B("f")
c = C("c")
g = D("g")
a = E("a")
e = F("e")

k.o = c
k.s = c
k.q = a
k.x = e
f.y = g
c.p = f
g.p = e
a.z = g
a.q = f
a.y = f
a.v = f
e.s = f
assert k.q.y.y.p.txt == "e"