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

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

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

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

class E:
    def __init__(self, txt: str):
        self.q: A = None
        self.t: D = None
        self.o: A = None
        self.w: A = None
        self.txt = txt

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

j = A("j")
m = B("m")
e = C("e")
k = D("k")
d = E("d")
g = F("g")

j.r = g
m.p = g
m.y = g
e.r = m
e.o = k
e.t = j
k.t = m
k.q = m
k.o = m
k.v = d
k.p = e
d.q = j
d.o = j
d.w = j
d.t = k
g.q = k
g.z = k
g.p = j
assert k.p.r.y.p.r.txt == "
class A:
    def __init__(self, txt: str):
        self.r: F = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.q: A = None
        self.t: D = None
        self.o: A = None
        self.w: A = None
        self.txt = txt

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

j = A("j")
m = B("m")
e = C("e")
k = D("k")
d = E("d")
g = F("g")

j.r = g
m.p = g
m.y = g
e.r = m
e.o = k
e.t = j
k.t = m
k.q = m
k.o = m
k.v = d
k.p = e
d.q = j
d.o = j
d.w = j
d.t = k
g.q = k
g.z = k
g.p = j
assert k.p.r.y.p.r.txt == "g"