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

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.u: C = None
        self.r: C = None
        self.x: A = None
        self.s: B = None
        self.t: A = None
        self.o: B = None
        self.txt = txt

g = A("g")
m = B("m")
f = C("f")
k = D("k")
b = E("b")
l = F("l")

g.y = k
g.u = k
g.p = m
m.p = l
m.s = l
m.x = b
m.o = b
m.z = b
m.y = k
f.x = g
f.t = g
f.p = k
k.s = m
k.o = f
k.p = l
b.r = k
l.u = f
l.r = f
l.x = g
l.t = g
l.s = m
l.o = m
assert g.p.p.t.y.s.txt == "
class A:
    def __init__(self, txt: str):
        self.y: D = None
        self.u: D = None
        self.p: B = None
        self.txt = txt

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.u: C = None
        self.r: C = None
        self.x: A = None
        self.s: B = None
        self.t: A = None
        self.o: B = None
        self.txt = txt

g = A("g")
m = B("m")
f = C("f")
k = D("k")
b = E("b")
l = F("l")

g.y = k
g.u = k
g.p = m
m.p = l
m.s = l
m.x = b
m.o = b
m.z = b
m.y = k
f.x = g
f.t = g
f.p = k
k.s = m
k.o = f
k.p = l
b.r = k
l.u = f
l.r = f
l.x = g
l.t = g
l.s = m
l.o = m
assert g.p.p.t.y.s.txt == "m"