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

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

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

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

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

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

g = A("g")
h = B("h")
k = C("k")
n = D("n")
c = E("c")
m = F("m")

g.o = c
g.r = c
g.x = c
g.s = c
g.u = k
h.p = m
k.t = g
n.u = g
n.v = g
c.z = n
c.x = m
m.o = g
m.z = n
m.s = n
assert g.u.t.u.t.txt == "
class A:
    def __init__(self, txt: str):
        self.o: E = None
        self.r: E = None
        self.x: E = None
        self.s: E = None
        self.u: C = None
        self.txt = txt

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

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

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

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

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

g = A("g")
h = B("h")
k = C("k")
n = D("n")
c = E("c")
m = F("m")

g.o = c
g.r = c
g.x = c
g.s = c
g.u = k
h.p = m
k.t = g
n.u = g
n.v = g
c.z = n
c.x = m
m.o = g
m.z = n
m.s = n
assert g.u.t.u.t.txt == "g"